package com.qdev.apps.core.domain;

import java.io.Serializable;

/**
 * @author	Quake Wang
 * @since	2004-6-4
 * @version $Revision: 1.2 $
 * 
 **/
public abstract class Entity implements Serializable {
	private Long id;
	
	public boolean isNew() {
		return (this.id == null);
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
			
		if (o == null)
			return false;
			
		if (!(o instanceof Entity))
			return false;
			
		if (this.isNew() || ((Entity) o).isNew())
			return false;
			
		return (getId().equals(((Entity) o).getId()));
	}
    
	public String toString() {
		return (this.getClass().getName() + ":" + id);
	}	

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

}
